//
//  PopupView.m
//  blackjack
//
//  Created by Thi Nguyen Tran on 4/3/10.
//  Copyright 2010 Epsilon. All rights reserved.
//

#import "PopupView.h"


@implementation PopupView

@synthesize delegate;

#define WIDTH	150
#define HEIGHT	40

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
		[self setImage:[UIImage imageNamed:@"tutor_choose_system_shadow.png"]];
		//UIFont *font = [UIFont fontWithName:@"Dimitri" size:20];
		UILabel * l1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
		[self addSubview:l1];
		//[l1 setFont:font];
		[l1 setTextColor:[UIColor whiteColor]];
		[l1 setBackgroundColor:[UIColor clearColor]];
		[l1 setTextAlignment:UITextAlignmentCenter];
		[l1 setText:@"KO"];
		[l1 release];
		l1 = [[UILabel alloc] initWithFrame:CGRectMake(0, HEIGHT, WIDTH, HEIGHT)];
		[self addSubview:l1];
		//[l1 setFont:font];
		[l1 setTextColor:[UIColor whiteColor]];
		[l1 setBackgroundColor:[UIColor clearColor]];
		[l1 setTextAlignment:UITextAlignmentCenter];
		[l1 setText:@"Hi LO"];
		[l1 release];
		l1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 2*HEIGHT, WIDTH, HEIGHT)];
		[self addSubview:l1];
		//[l1 setFont:font];
		[l1 setTextColor:[UIColor whiteColor]];
		[l1 setBackgroundColor:[UIColor clearColor]];
		[l1 setTextAlignment:UITextAlignmentCenter];
		[l1 setText:@"Hi Opt I"];
		[l1 release];
		l1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 3*HEIGHT, WIDTH, HEIGHT)];
		[self addSubview:l1];
		//[l1 setFont:font];
		[l1 setTextColor:[UIColor whiteColor]];
		[l1 setBackgroundColor:[UIColor clearColor]];
		[l1 setTextAlignment:UITextAlignmentCenter];
		[l1 setText:@"Hi Opt II"];
		[l1 release];
		l1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 4*HEIGHT, WIDTH, HEIGHT)];
		[self addSubview:l1];
		//[l1 setFont:font];
		[l1 setTextColor:[UIColor whiteColor]];
		[l1 setBackgroundColor:[UIColor clearColor]];
		[l1 setTextAlignment:UITextAlignmentCenter];
		[l1 setText:@"Omega"];
		[l1 release];
    }
    return self;
}


- (void)touchesBegan:(NSSet *)touches 
		   withEvent:(UIEvent *)event {
	[self setUserInteractionEnabled:NO];
	UITouch * touch = [touches anyObject];
	CGPoint point = [touch locationInView:[touch view]];
	int val = point.y / HEIGHT;
	if(val >= 0 && val < NUMBER_OF_COUNT) {
		[delegate chooseCountingSystem:val];
	}
}

- (void)dealloc {
    [super dealloc];
}


@end
